#ifndef HANDLER_H
#define HANDLER_H
#include <Windows.h>
class Handler 
{
public:
	Handler() {}
	virtual ~ Handler() {}
public:
	virtual int createView () {return 0;}
	virtual int updateView () {return 0;}
	virtual int updateModel () {return 0;}
	virtual int addListener () {return 0;}
	virtual int processMessage () {return 0;}
	virtual int writeLog () {return 0;}

	void setHandle(HWND handle);                            // set window handle

	virtual int close();                                    // for WM_CLOSE
	virtual int command(int id, int cmd, LPARAM msg);       // for WM_COMMAND: id, cmd, msg
	virtual int contextMenu(HWND handle, int x, int y);     // for WM_CONTEXTMENU: handle, x, y
	virtual int create();                                   // for WM_CREATE
	virtual int destroy();                                  // for WM_DESTROY
	virtual int enable(bool flag);                          // for WM_ENABLE: flag(true/false)
	virtual int eraseBkgnd(HDC hdc);                        // for WM_ERASEBKGND: HDC
	virtual int hScroll(WPARAM wParam, LPARAM lParam);      // for WM_HSCROLL
	virtual int keyDown(int key, LPARAM lParam);            // for WM_KEYDOWN: keyCode, detailInfo
	virtual int keyUp(int key, LPARAM lParam);              // for WM_KEYUP: keyCode, detailInfo
	virtual int lButtonDown(WPARAM state, int x, int y);    // for WM_LBUTTONDOWN: state, x, y
	virtual int lButtonUp(WPARAM state, int x, int y);      // for WM_LBUTTONUP: state, x, y
	virtual int mButtonDown(WPARAM state, int x, int y);    // for WM_MBUTTONDOWN: state, x, y
	virtual int mButtonUp(WPARAM state, int x, int y);      // for WM_MBUTTONUP: state, x, y
	virtual int mouseMove(WPARAM state, int x, int y);      // for WM_MOUSEMOVE: state, x, y
	virtual int notify(int id, LPARAM lParam);              // for WM_NOTIFY: HandlerID, NMHDR
	virtual int paint();                                    // for WM_PAINT
	virtual int rButtonDown(WPARAM wParam, int x, int y);   // for WM_RBUTTONDOWN: state, x, y
	virtual int rButtonUp(WPARAM wParam, int x, int y);     // for WM_RBUTTONUP: state, x, y
	virtual int size(int w, int h, WPARAM wParam);          // for WM_SIZE: width, height, type(SIZE_MAXIMIZED...)
	virtual int timer(WPARAM id, LPARAM lParam);            // for WM_TIMER: ID, ptr to callback ftn
	virtual int vScroll(WPARAM wParam, LPARAM lParam);      // for WM_VSCROLL


protected:
	HWND handle;                                            // window handle to map window to Handler

private:
	// Handler class must reference to Model and View components.
	// Handler receives an event from the user and translates it to
	// Model and View to perform actions based on that input.
	//Model model;
	//View  view;
};

inline void Handler::setHandle(HWND hwnd) { handle = hwnd; }
inline int  Handler::close() { ::DestroyWindow(handle); return 0; }
inline int  Handler::command(int id, int cmd, LPARAM msg) { return 0; }
inline int  Handler::contextMenu(HWND handle, int x, int y) { return 0; }
inline int  Handler::create() {return 0; }
inline int  Handler::destroy() { ::PostQuitMessage(0); return 0; }
inline int  Handler::enable(bool flag) { return 0; }
inline int  Handler::eraseBkgnd(HDC hdc) { return 0; }
inline int  Handler::hScroll(WPARAM wParam, LPARAM lParam) { return 0; }
inline int  Handler::keyDown(int key, LPARAM lParam) { return 0; }
inline int  Handler::keyUp(int key, LPARAM lParam) { return 0; }
inline int  Handler::lButtonDown(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::lButtonUp(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::mButtonDown(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::mButtonUp(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::mouseMove(WPARAM keyState, int x, int y) { return 0; }
inline int  Handler::notify(int id, LPARAM lParam) { return 0; }
inline int  Handler::paint() { return 0; }
inline int  Handler::rButtonDown(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::rButtonUp(WPARAM wParam, int x, int y) { return 0; }
inline int  Handler::size(int w, int h, WPARAM type) { return 0; }
inline int  Handler::timer(WPARAM id, LPARAM lParam) { return 0; }
inline int  Handler::vScroll(WPARAM wParam, LPARAM lParam) { return 0; }

#endif
